class Student{
    private String name;
    private int age;
    private String stuNum;
    //public String classname;
    public static String classname;


    public void printInformation(){
        System.out.println("学生的姓名："+this.name+" "+"学生的年龄："+this.age+" "+"学生的学号："+this.stuNum+"班级是"+this.classname);
    }

    //带参数的构造方法(构造方法名字要与类名相同)
    public Student(String name,int age,String stuNum){
        this.name=name;
        this.age=age;
        this.stuNum=stuNum;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

}


public class Test1 {
    public static void main(String[] args) {
        Student student5=null;
        Student.classname="1班";
        System.out.println(Student.classname);
//        System.out.println(student5.getName());//该成员变量依赖于对象
    }
    public static void main1(String[] args) {
        //Student student1=new Student();
//        student1.name="zhangsan";
//        student1.age=10;
//        student1.stuNum="1001";被private修饰的成员变量或成员方法只能在当前类中使用，不能在当前类外使用
       /* student1.setName("zhangsan");
        student1.getName();

        student1.setAge(10);
        student1.getAge();

        student1.setStuNum("10011");
        student1.getStuNum();

        student1.printInformation();*/

        Student.classname="1班";//这里的classname被static修饰是静态的成员变量，也就是说这个变量属于类不是对象的！

        Student student2=new Student("lisi",12,"1003");
        student2.printInformation();

        Student student3=new Student("wanwu",14,"1004");
        student3.printInformation();

    }
}
